<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>Phonon.MediaObject Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">Phonon.MediaObject Class Reference<br /><sup><sup>[<a href="phonon.html">phonon</a> module]</sup></sup></h1><p>The MediaObject class provides an interface for media playback.
<a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a> and <a href="phonon-medianode.html">MediaNode</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="phonon-mediaobject.html#MediaObject">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#clearQueue">clearQueue</a></b> (<i>self</i>)</li><li><div class="fn" />MediaSource <b><a href="phonon-mediaobject.html#currentSource">currentSource</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#currentTime">currentTime</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#enqueue">enqueue</a></b> (<i>self</i>, MediaSource&#160;<i>source</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#enqueue-2">enqueue</a></b> (<i>self</i>, list-of-Phonon.MediaSource&#160;<i>sources</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#enqueue-3">enqueue</a></b> (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</li><li><div class="fn" />QString <b><a href="phonon-mediaobject.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />ErrorType <b><a href="phonon-mediaobject.html#errorType">errorType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-mediaobject.html#hasVideo">hasVideo</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="phonon-mediaobject.html#isSeekable">isSeekable</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="phonon-mediaobject.html#metaData">metaData</a></b> (<i>self</i>, QString&#160;<i>key</i>)</li><li><div class="fn" />QStringList <b><a href="phonon-mediaobject.html#metaData-2">metaData</a></b> (<i>self</i>, MetaData&#160;<i>key</i>)</li><li><div class="fn" />dict-of-QString-list-of-QString <b><a href="phonon-mediaobject.html#metaData-3">metaData</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#pause">pause</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#play">play</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#prefinishMark">prefinishMark</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-Phonon.MediaSource <b><a href="phonon-mediaobject.html#queue">queue</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#remainingTime">remainingTime</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#seek">seek</a></b> (<i>self</i>, int&#160;<i>time</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setCurrentSource">setCurrentSource</a></b> (<i>self</i>, MediaSource&#160;<i>source</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setPrefinishMark">setPrefinishMark</a></b> (<i>self</i>, int&#160;<i>msecToEnd</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setQueue">setQueue</a></b> (<i>self</i>, list-of-Phonon.MediaSource&#160;<i>sources</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setQueue-2">setQueue</a></b> (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setTickInterval">setTickInterval</a></b> (<i>self</i>, int&#160;<i>newTickInterval</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#setTransitionTime">setTransitionTime</a></b> (<i>self</i>, int&#160;<i>msec</i>)</li><li><div class="fn" />State <b><a href="phonon-mediaobject.html#state">state</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="phonon-mediaobject.html#stop">stop</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#tickInterval">tickInterval</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#totalTime">totalTime</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="phonon-mediaobject.html#transitionTime">transitionTime</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a></b> ()</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#bufferStatus">bufferStatus</a></b> (int)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#currentSourceChanged">currentSourceChanged</a></b> (const Phonon::MediaSource&amp;)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#finished">finished</a></b> ()</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#hasVideoChanged">hasVideoChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#metaDataChanged">metaDataChanged</a></b> ()</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#prefinishMarkReached">prefinishMarkReached</a></b> (qint32)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#seekableChanged">seekableChanged</a></b> (bool)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#stateChanged">stateChanged</a></b> (Phonon::State,Phonon::State)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#tick">tick</a></b> (qint64)</li><li><div class="fn" />void <b><a href="phonon-mediaobject.html#totalTimeChanged">totalTimeChanged</a></b> (qint64)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The MediaObject class provides an interface for media
playback.</p>
<p>The media object manages a <a href="phonon-mediasource.html">MediaSource</a>, which supplies the media
object with multimedia content, e.g., from a file. A playback in
Phonon is always started by calling the <a href="phonon-mediaobject.html#play">play()</a> function.</p>
<p>The state of play (play, pause, stop, seek) is controlled by the
media object, and you can also query the current <a href="phonon-mediaobject.html#state">state()</a>. It keeps track of the
playback position in the media stream, and emits the <a href="phonon-mediaobject.html#tick">tick()</a> signal when the current
position in the stream changes.</p>
<p>Notice that most functions of this class are asynchronous, so
you cannot rely on that a state is entered after a function call
before you receive the <a href="phonon-mediaobject.html#stateChanged">stateChanged()</a> signal.
The description of the <a href="phonon.html#State-enum">State</a>
enum gives a description of the different states.</p>
<p>Before <a href="phonon-mediaobject.html#play">play</a>() is
called, the media object should be connected to <a href="phonon-overview.html#sinks">output nodes</a>, which outputs the
media to the underlying hardware. The output nodes required are
dependent on the contents of the multimedia file that is played
back. Phonon has currently two output nodes: the <a href="phonon-audiooutput.html">AudioOutput</a> for audio content and
<a href="phonon-videowidget.html">VideoWidget</a> for video
content. If a <a href="phonon-mediasource.html">MediaSource</a>
contains both audio and video, both nodes need to be connected to
the media object.</p>
<pre class="cpp">
     Phonon<span class="operator">.</span>MediaObject <span class="operator">*</span>mediaObject <span class="operator">=</span> <span class="keyword">new</span> Phonon<span class="operator">.</span>MediaObject(<span class="keyword">this</span>);

     Phonon<span class="operator">.</span>VideoWidget <span class="operator">*</span>videoWidget <span class="operator">=</span> <span class="keyword">new</span> Phonon<span class="operator">.</span>VideoWidget(<span class="keyword">this</span>);
     Phonon<span class="operator">.</span>createPath(mediaObject<span class="operator">,</span> videoWidget);

     Phonon<span class="operator">.</span>AudioOutput <span class="operator">*</span>audioOutput <span class="operator">=</span>
         <span class="keyword">new</span> Phonon<span class="operator">.</span>AudioOutput(Phonon<span class="operator">.</span>VideoCategory<span class="operator">,</span> <span class="keyword">this</span>);
     Phonon<span class="operator">.</span>createPath(mediaObject<span class="operator">,</span> audioOutput);
     mediaObject<span class="operator">-</span><span class="operator">&gt;</span>play();
</pre>
<p>The media object can queue sources for playback. When it has
finished to play one source, it will start playing the next in the
queue; the new source is then removed from the queue. The queue can
be altered at any time.</p>
<pre class="cpp">
 media<span class="operator">-</span><span class="operator">&gt;</span>setCurrentSource(<span class="string">":/sounds/startsound.ogg"</span>);
 media<span class="operator">-</span><span class="operator">&gt;</span>enqueue(<span class="string">"/home/username/music/song.mp3"</span>);
 media<span class="operator">-</span><span class="operator">&gt;</span>enqueue(<span class="string">":/sounds/endsound.ogg"</span>);
</pre>
<p>You can also make use of the <a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish()</a> signal,
which is guaranteed to be emitted in time for altering the
queue.</p>
<pre class="cpp">
   media<span class="operator">-</span><span class="operator">&gt;</span>setCurrentSource(<span class="string">":/sounds/startsound.ogg"</span>);
   connect(media<span class="operator">,</span> SIGNAL(aboutToFinish())<span class="operator">,</span> SLOT(enqueueNextSource()));
 }

 <span class="type">void</span> enqueueNextSource()
 {
   media<span class="operator">-</span><span class="operator">&gt;</span>enqueue(<span class="string">"/home/username/music/song.mp3"</span>);
 }
</pre>
<p>When playback is finishing, i.e., when a media source has been
played to the end and the queue is empty, several signals are
emitted. First, the media object will emit <a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a>() -
shortly before the playback has finished - and then <a href="phonon-mediaobject.html#finished">finished</a>(). The <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>() signal
will also be emitted with <a href="phonon.html#State-enum">PausedState</a>, which is the state the
media object takes when the playback is finished. If you wish to
enter another state, you can connect a slot to <a href="phonon-mediaobject.html#finished">finished</a>() and set a new
state there.</p>
<p>The media object resolves the meta information, such as title,
artist, and album. The meta data is not resolved immediately after
a new source is provided, but will be resolved before the object
leaves the <a href="phonon.html#State-enum">LoadingState</a>. The
data is queried by string keys - which should follow the Ogg Vorbis
specification <a href="http://xiph.org/vorbis/doc/v-comment.html">http://xiph.org/vorbis/doc/v-comment.html</a>
- or by using the <a href="phonon.html#MetaData-enum">MetaData</a>
enum. The data available will depend on the type and content of the
individual media files. <a href="phonon-mediaobject.html#metaDataChanged">metaDataChanged</a>()
will be emitted when the media object has resolved new meta
data.</p>
<p>Errors encountered during playback and loading of media sources
are reported by emitting a state changed signal with <a href="phonon.html#State-enum">ErrorState</a>. The severity of the error
can be queried by the <a href="phonon.html#ErrorType-enum">ErrorType</a>. With a <a href="phonon.html#ErrorType-enum">NormalError</a>, it might be possible
to continue the playback, for instance, if only audio playback
fails for a media source which also has video. A <a href="phonon.html#ErrorType-enum">FatalError</a> indicates that Phonon
cannot continue playback of the current source, but it is possible
to try with a different one. A user readable error message is given
by <a href="phonon-mediaobject.html#errorString">errorString</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="MediaObject" />MediaObject.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><h3 class="fn"><a name="clear" />MediaObject.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>Stops and removes all playing and enqueued media sources.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setCurrentSource">setCurrentSource</a>().</p>


<h3 class="fn"><a name="clearQueue" />MediaObject.clearQueue (<i>self</i>)</h3><p>Clears the queue of media sources.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#queue">queue</a>() and <a href="phonon-mediaobject.html#enqueue">enqueue</a>().</p>


<h3 class="fn"><a name="currentSource" /><a href="phonon-mediasource.html">MediaSource</a> MediaObject.currentSource (<i>self</i>)</h3><p>Returns the current media source, i.e., the media source that is
being played back. The current source is either set with <a href="phonon-mediaobject.html#setCurrentSource">setCurrentSource</a>()
or taken from the media <a href="phonon-mediaobject.html#queue">queue</a>() when a media source has
finished playing.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setCurrentSource">setCurrentSource</a>().</p>


<h3 class="fn"><a name="currentTime" />int MediaObject.currentTime (<i>self</i>)</h3><p>Returns the current time (in milliseconds), i.e., position in
the media stream, of the file currently being played.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#tick">tick</a>(), <a href="phonon-mediaobject.html#totalTime">totalTime</a>(), and <a href="phonon-mediaobject.html#remainingTime">remainingTime</a>().</p>


<h3 class="fn"><a name="enqueue" />MediaObject.enqueue (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>&#160;<i>source</i>)</h3><p>Appends <i>source</i> to the queue.</p>
<p>You can use this function to provide the next source after the
<a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a>()
signal has been emitted.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a>(),
<a href="phonon-mediaobject.html#setQueue">setQueue</a>(), and
<a href="phonon-mediaobject.html#clearQueue">clearQueue</a>().</p>


<h3 class="fn"><a name="enqueue-2" />MediaObject.enqueue (<i>self</i>, list-of-Phonon.MediaSource&#160;<i>sources</i>)</h3><p>Appends multiple <i>sources</i> to the queue.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setQueue">setQueue</a>() and <a href="phonon-mediaobject.html#clearQueue">clearQueue</a>().</p>


<h3 class="fn"><a name="enqueue-3" />MediaObject.enqueue (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</h3><p>Appends the URLs in <i>urls</i> to the media source queue.</p>
<p>The function will create <a href="phonon-mediasource.html">MediaSource</a>s from the <a href="qurl.html">QUrl</a>s, and append these to the queue.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setQueue">setQueue</a>() and <a href="phonon-mediaobject.html#clearQueue">clearQueue</a>().</p>


<h3 class="fn"><a name="errorString" />QString MediaObject.errorString (<i>self</i>)</h3><p>Returns a human-readable description of the last error that
occurred. The strings given may vary between backends.</p>
<p>The error description can be used to give a message to the user
- and the developer - when the <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>() signal is
emitted with <a href="phonon.html#State-enum">ErrorState</a>.</p>
<a id="qt-backends" name="qt-backends" />
<h4>Qt Backends</h4>
<p>On Windows, Qt fetches its error messages from the DirectShow
backend. This usually includes an error number, which can be looked
up in the DirectShow documentation: <a href="http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/directx_cpp/htm/errorandsuccesscodes.asp">
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dx81_c/directx_cpp/htm/errorandsuccesscodes.asp</a>.</p>
<p>On Linux and Mac, the error strings are not fetched directly
from the backend, but are created in the backend.</p>
<p><b>See also</b> <a href="phonon.html#State-enum">Phonon.ErrorState</a> and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="errorType" /><a href="phonon.html#ErrorType-enum">ErrorType</a> MediaObject.errorType (<i>self</i>)</h3><p>Tells your program what to do about the last error that
occurred. Use this function after receiving a <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>() signal
with <a href="phonon.html#State-enum">ErrorState</a>.</p>
<p><b>See also</b> <a href="phonon.html#ErrorType-enum">Phonon.ErrorType</a>, <a href="phonon.html#State-enum">Phonon.ErrorState</a>, and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="hasVideo" />bool MediaObject.hasVideo (<i>self</i>)</h3><p>Check whether the current media source includes a video
stream.</p>
<p><b>Warning:</b> This information is not resolved immediately
after a media object gets a new source. Listen to the <a href="phonon-mediaobject.html#hasVideoChanged">hasVideoChanged</a>()
signal instead.</p>
<pre class="cpp">
   connect(media<span class="operator">,</span> SIGNAL(hasVideoChanged(<span class="type">bool</span>))<span class="operator">,</span> hasVideoChanged(<span class="type">bool</span>));
   media<span class="operator">-</span><span class="operator">&gt;</span>setCurrentSource(<span class="string">"somevideo.avi"</span>);
   media<span class="operator">-</span><span class="operator">&gt;</span>hasVideo(); <span class="comment">// returns false;</span>
 }

 <span class="type">void</span> hasVideoChanged(<span class="type">bool</span> b)
 {
   <span class="comment">// b == true</span>
   media<span class="operator">-</span><span class="operator">&gt;</span>hasVideo(); <span class="comment">// returns true;</span>
 }
</pre>
<p>Returns <tt>true</tt> if the media contains video data;
otherwise, returns <tt>false</tt>.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#hasVideoChanged">hasVideoChanged</a>().</p>


<h3 class="fn"><a name="isSeekable" />bool MediaObject.isSeekable (<i>self</i>)</h3><p>Check whether it is possible to seek, i.e., change the playback
position in the media stream.</p>
<p><b>Warning:</b> This information is not solved immediately after
the media object gets a new media source. The <a href="phonon-mediaobject.html#hasVideoChanged">hasVideoChanged</a>()
signal is emitted after this information is available.</p>
<pre class="cpp">
   connect(media<span class="operator">,</span> SIGNAL(hasVideoChanged(<span class="type">bool</span>))<span class="operator">,</span> hasVideoChanged(<span class="type">bool</span>));
   media<span class="operator">-</span><span class="operator">&gt;</span>setCurrentSource(<span class="string">"somevideo.avi"</span>);
   media<span class="operator">-</span><span class="operator">&gt;</span>hasVideo(); <span class="comment">// returns false;</span>
 }

 <span class="type">void</span> hasVideoChanged(<span class="type">bool</span> b)
 {
   <span class="comment">// b == true</span>
   media<span class="operator">-</span><span class="operator">&gt;</span>hasVideo(); <span class="comment">// returns true;</span>
 }
</pre>
<p>Returns <tt>true</tt> if the current media may be seeked;
otherwise, returns <tt>false</tt>.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#seekableChanged">seekableChanged</a>().</p>


<h3 class="fn"><a name="metaData" />QStringList MediaObject.metaData (<i>self</i>, QString&#160;<i>key</i>)</h3><p>Returns the strings associated with the given <i>key</i>.</p>
<p>Backends should use the keys specified in the Ogg Vorbis
documentation: <a href="http://xiph.org/vorbis/doc/v-comment.html">http://xiph.org/vorbis/doc/v-comment.html</a></p>
<p>Therefore the following should work with every backend:</p>
<p>Note that meta data is not resolved before the
<tt>metaDataChanged()</tt> signal is emitted.</p>
<p>A typical usage looks like this:</p>
<pre class="cpp">
 setMetaArtist(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"ARTIST"</span>));
 setMetaAlbum(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"ALBUM"</span>));
 setMetaTitle(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"TITLE"</span>));
 setMetaDate(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"DATE"</span>));
 setMetaGenre(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"GENRE"</span>));
 setMetaTrack(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"TRACKNUMBER"</span>));
 setMetaComment(media<span class="operator">-</span><span class="operator">&gt;</span>metaData(<span class="string">"DESCRIPTION"</span>));
</pre>


<h3 class="fn"><a name="metaData-2" />QStringList MediaObject.metaData (<i>self</i>, <a href="phonon.html#MetaData-enum">MetaData</a>&#160;<i>key</i>)</h3><p>Returns the strings associated with the given <i>key</i>.</p>
<p>Same as above except that the keys are defined in the <a href="phonon.html#MetaData-enum">Phonon.MetaData</a> enum.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#metaDataChanged">metaDataChanged</a>().</p>


<h3 class="fn"><a name="metaData-3" />dict-of-QString-list-of-QString MediaObject.metaData (<i>self</i>)</h3><p>Returns all meta data in a multi map.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#metaDataChanged">metaDataChanged</a>().</p>


<h3 class="fn"><a name="pause" />MediaObject.pause (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void pause()</tt>.</p><p>Requests playback to pause, and the media object to enter the
<a href="phonon.html#State-enum">PausedState</a>. If it was paused
already, nothing changes.</p>
<p>This function is asynchronous and the media might not be paused
immediately.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#play">play</a>(), <a href="phonon-mediaobject.html#stop">stop</a>(), and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="play" />MediaObject.play (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void play()</tt>.</p><p>Requests playback of the media data to start.</p>
<p>Playback starts when the <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>() signal is
emitted with <a href="phonon.html#State-enum">PlayingState</a>.</p>
<p>If the media object is already in a <a href="phonon.html#State-enum">PlayingState</a>, nothing happens.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#stop">stop</a>(), <a href="phonon-mediaobject.html#pause">pause</a>(), and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="prefinishMark" />int MediaObject.prefinishMark (<i>self</i>)</h3><h3 class="fn"><a name="queue" />list-of-Phonon.MediaSource MediaObject.queue (<i>self</i>)</h3><p>Returns the queued media sources.</p>
<p>This does list does not include the current source, returned by
<a href="phonon-mediaobject.html#currentSource">currentSource</a>().</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#setQueue">setQueue</a>() and <a href="phonon-mediaobject.html#enqueue">enqueue</a>().</p>


<h3 class="fn"><a name="remainingTime" />int MediaObject.remainingTime (<i>self</i>)</h3><p>Get the remaining time (in milliseconds) of the file currently
being played.</p>
<p>Returns the remaining time in milliseconds.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#totalTime">totalTime</a>(), <a href="phonon-mediaobject.html#currentTime">currentTime</a>(), and
<a href="phonon-mediaobject.html#totalTimeChanged">totalTimeChanged</a>().</p>


<h3 class="fn"><a name="seek" />MediaObject.seek (<i>self</i>, int&#160;<i>time</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void seek(qint64)</tt>.</p><p>Requests a seek to the <i>time</i> indicated, specified in
milliseconds.</p>
<p>You can only seek if <a href="phonon-mediaobject.html#state">state</a>() is <a href="phonon.html#State-enum">PlayingState</a>, <a href="phonon.html#State-enum">BufferingState</a> or <a href="phonon.html#State-enum">PausedState</a>.</p>
<p>The call is asynchronous, so currentTime can still be the old
value right after this method was called. If all you need is a
slider that shows the current position and allows the user to seek,
use the class <a href="phonon-seekslider.html">SeekSlider</a>.</p>
<p>If the current source of the media object is not seekable, calls
to this functions do nothing.</p>
<p><b>See also</b> <a href="phonon-seekslider.html">SeekSlider</a>
and <a href="phonon-mediaobject.html#tick">tick</a>().</p>


<h3 class="fn"><a name="setCurrentSource" />MediaObject.setCurrentSource (<i>self</i>, <a href="phonon-mediasource.html">MediaSource</a>&#160;<i>source</i>)</h3><p>Set the media source the <a href="phonon-mediaobject.html">MediaObject</a> should use.</p>
<p>After the media object receives a new source, it will enter the
<a href="phonon.html#State-enum">LoadingState</a>. When it is ready
to play, it enters the <a href="phonon.html#State-enum">StoppedState</a> unless another state has
been requested, e.g., by calling <a href="phonon-mediaobject.html#play">play</a>().</p>
<p><i>source</i> is the <a href="phonon-mediasource.html">MediaSource</a> object to the media data.
You can just as well use a <a href="qurl.html">QUrl</a> or <a href="qstring.html">QString</a> (for a local file) here.</p>
<p>We show an example:</p>
<pre class="cpp">
 <span class="type"><a href="qurl.html">QUrl</a></span> url(<span class="string">"http://www.example.com/music.ogg"</span>);
 media<span class="operator">-</span><span class="operator">&gt;</span>setCurrentSource(url);
</pre>
<p><b>See also</b> <a href="phonon-mediaobject.html#currentSource">currentSource</a>() and
<a href="phonon-mediasource.html">MediaSource</a>.</p>


<h3 class="fn"><a name="setPrefinishMark" />MediaObject.setPrefinishMark (<i>self</i>, int&#160;<i>msecToEnd</i>)</h3><h3 class="fn"><a name="setQueue" />MediaObject.setQueue (<i>self</i>, list-of-Phonon.MediaSource&#160;<i>sources</i>)</h3><p>Set the <i>sources</i> to play when the current source has
finished.</p>
<p>This function will overwrite the current queue.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#clearQueue">clearQueue</a>() and <a href="phonon-mediaobject.html#enqueue">enqueue</a>().</p>


<h3 class="fn"><a name="setQueue-2" />MediaObject.setQueue (<i>self</i>, list-of-QUrl&#160;<i>urls</i>)</h3><p>Set the <i>urls</i> to play when the current media has
finished.</p>
<p>This function overwrites the current queue.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#clearQueue">clearQueue</a>() and <a href="phonon-mediaobject.html#enqueue">enqueue</a>().</p>


<h3 class="fn"><a name="setTickInterval" />MediaObject.setTickInterval (<i>self</i>, int&#160;<i>newTickInterval</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setTickInterval(qint32)</tt>.</p><h3 class="fn"><a name="setTransitionTime" />MediaObject.setTransitionTime (<i>self</i>, int&#160;<i>msec</i>)</h3><h3 class="fn"><a name="state" /><a href="phonon.html#State-enum">State</a> MediaObject.state (<i>self</i>)</h3><p>Returns the current <a href="phonon.html#State-enum">Phonon.State</a> of the object.</p>
<p><b>See also</b> <a href="phonon.html#State-enum">Phonon.State</a> and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="stop" />MediaObject.stop (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void stop()</tt>.</p><p>Requests playback to stop, and the media object to enter the
<a href="phonon.html#State-enum">StoppedState</a>. If it was
stopped before nothing changes.</p>
<p>This function is asynchronous and the media might not be stopped
immediately.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#play">play</a>(), <a href="phonon-mediaobject.html#pause">pause</a>(), and <a href="phonon-mediaobject.html#stateChanged">stateChanged</a>().</p>


<h3 class="fn"><a name="tickInterval" />int MediaObject.tickInterval (<i>self</i>)</h3><h3 class="fn"><a name="totalTime" />int MediaObject.totalTime (<i>self</i>)</h3><p>Get the total time (in milliseconds) of the file currently being
played.</p>
<p>Returns the total time in milliseconds.</p>
<p><b>Warning:</b> The total time is not defined before the media
object enters the <a href="phonon.html#State-enum">LoadingState</a>.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#totalTimeChanged">totalTimeChanged</a>().</p>


<h3 class="fn"><a name="transitionTime" />int MediaObject.transitionTime (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="aboutToFinish" />void aboutToFinish ()</h3><p>This is the default overload of this signal.</p><p>Emitted before the playback of the whole queue ends. When this
signal is emitted you still have time to <a href="phonon-mediaobject.html#enqueue">enqueue</a>() a new <a href="phonon-mediasource.html">MediaSource</a>, so that playback
continues.</p>
<p>If you need a signal to be emitted at a specific time before
playback is finished, you should use the <a href="phonon-mediaobject.html#prefinishMarkReached">prefinishMarkReached</a>()
signal instead.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#enqueue">enqueue</a>(), <a href="phonon-mediaobject.html#prefinishMark-prop">prefinishMark</a>, and
<a href="phonon-mediaobject.html#prefinishMarkReached">prefinishMarkReached</a>().</p>


<h3 class="fn"><a name="bufferStatus" />void bufferStatus (int)</h3><p>This is the default overload of this signal.</p><p>Provides information about the status of the buffer.</p>
<p>When a <a href="phonon-mediaobject.html">MediaObject</a> is in
the <a href="phonon.html#State-enum">BufferingState</a>, it will
send this signal regularly. <i>percentFilled</i> is a number
between 0 and 100 telling you how much the buffer is filled.</p>
<p>You can use this signal to show a progress bar to the user when
in <a href="phonon.html#State-enum">BufferingState</a>:</p>
<pre class="cpp">
 progressBar<span class="operator">-</span><span class="operator">&gt;</span>setRange(<span class="number">0</span><span class="operator">,</span> <span class="number">100</span>); <span class="comment">// this is the default</span>
 connect(media<span class="operator">,</span> SIGNAL(bufferStatus(<span class="type">int</span>))<span class="operator">,</span> progressBar<span class="operator">,</span> SLOT(setValue(<span class="type">int</span>)));
</pre>
<p>Note that the <a href="phonon.html#State-enum">BufferingState</a> is commonly used when
waiting for data over a network connection, but this might not be
true for all backends.</p>


<h3 class="fn"><a name="currentSourceChanged" />void currentSourceChanged (const Phonon::MediaSource&amp;)</h3><p>This is the default overload of this signal.</p><p>Emitted when the <a href="phonon-mediaobject.html">MediaObject</a> fetches a new <a href="phonon-mediasource.html">MediaSource</a> from the <a href="phonon-mediaobject.html#queue">queue</a>() and before it enters
the <a href="phonon.html#State-enum">LoadingState</a> for the new
source. The media object will take a new source from the <a href="phonon-mediaobject.html#queue">queue</a>() when it has finished
the playback of the <a href="phonon-mediaobject.html#currentSource">current source</a>.</p>
<p><i>newSource</i> is the source that starts to play at the time
the signal is emitted.</p>


<h3 class="fn"><a name="finished" />void finished ()</h3><p>This is the default overload of this signal.</p><p>Emitted when the object has finished playback. It is not emitted
if you call <a href="phonon-mediaobject.html#stop">stop</a>(),
<a href="phonon-mediaobject.html#pause">pause</a>() or load(). It
is emitted only when the current media source has finished playing
and the media <a href="phonon-mediaobject.html#queue">queue</a>()
is empty, or when a <a href="phonon.html#ErrorType-enum">fatal
error</a> occurs.</p>
<p><b>Warning:</b> This signal is not emitted when the current
source has finished and there's another source in the queue. It is
only emitted when the queue is empty.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#currentSourceChanged">currentSourceChanged</a>(),
<a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a>(), and
<a href="phonon-mediaobject.html#prefinishMarkReached">prefinishMarkReached</a>().</p>


<h3 class="fn"><a name="hasVideoChanged" />void hasVideoChanged (bool)</h3><p>This is the default overload of this signal.</p><p>Emitted whenever the return value of <a href="phonon-mediaobject.html#hasVideo">hasVideo</a>() changes, i.e.,
the media source being played back contains video.</p>
<p>Normally you'll check <a href="phonon-mediaobject.html#hasVideo">hasVideo</a>() first and then
let this signal tell you whether video is available now or not.
That way you don't have to poll <a href="phonon-mediaobject.html#hasVideo">hasVideo</a>().</p>
<p><i>hasVideo</i> is true when the stream contains video and
adding a <a href="phonon-videowidget.html">VideoWidget</a> will
show a video, and false if there is no video data in the stream and
adding a <a href="phonon-videowidget.html">VideoWidget</a> will
show an empty (black) <a href="phonon-videowidget.html">VideoWidget</a>.</p>


<h3 class="fn"><a name="metaDataChanged" />void metaDataChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the media object has resolved new
meta data. This will happen before the media object leaves the
<a href="phonon.html#State-enum">LoadingState</a> after a new
source has been set.</p>
<p>This signal is not emitted when the media object removes the
current data, i.e., when a new source is set or an error has
occurred. If you need to know this, you can listen for the <a href="phonon.html#State-enum">ErrorState</a>, and connect to the
<a href="phonon-mediaobject.html#currentSourceChanged">currentSourceChanged()</a>
signal.</p>
<p>You can get the new meta data with the metaData methods.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#metaData">metaData</a>(), <a href="phonon-mediaobject.html#currentSourceChanged">currentSourceChanged</a>(),
<a href="phonon-mediaobject.html#stateChanged">stateChanged</a>(),
and <a href="phonon.html#State-enum">Phonon.State</a>.</p>


<h3 class="fn"><a name="prefinishMarkReached" />void prefinishMarkReached (qint32)</h3><p>This is the default overload of this signal.</p><p>Emitted when there are only <i>msecToEnd</i> milliseconds left
of playback.</p>
<p><b>Warning:</b> This signal is not emitted when there is another
source in the queue. It is only emitted when the queue is
empty.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#prefinishMark-prop">setPrefinishMark</a>(),
<a href="phonon-mediaobject.html#prefinishMark-prop">prefinishMark</a>(),
<a href="phonon-mediaobject.html#aboutToFinish">aboutToFinish</a>(), and
<a href="phonon-mediaobject.html#finished">finished</a>().</p>


<h3 class="fn"><a name="seekableChanged" />void seekableChanged (bool)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the media object's ability to seek
in the media stream changes. <i>isSeekable</i> is true if it is
possible to <a href="phonon-mediaobject.html#seek">seek</a>();
otherwise, it is false.</p>
<p>Change in the ability to seek in the stream usually happens when
the current source changes or when an error occurs.</p>
<p>Normally you'll check <a href="phonon-mediaobject.html#isSeekable">isSeekable</a>() after setting
a new media source, and then let this signal tell you when seeking
is possible. That way you don't have to poll <a href="phonon-mediaobject.html#isSeekable">isSeekable</a>().</p>


<h3 class="fn"><a name="stateChanged" />void stateChanged (Phonon::State,Phonon::State)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the state of the <a href="phonon-mediaobject.html">MediaObject</a> has changed. The
<i>oldstate</i> and <i>newstate</i> parameters indicate the
previous state and current state of the media object.</p>
<p>If you are only interested in the new state of the media object,
you can connect this signal to a slot that accepts only one State
argument.</p>


<h3 class="fn"><a name="tick" />void tick (qint64)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted in intervals defined by the <a href="phonon-mediaobject.html#tickInterval-prop">tickInterval</a>
property. The current position of the media object in the stream is
given by the <i>time</i> parameter. The <i>time</i> is specified in
milliseconds.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#tickInterval-prop">tickInterval</a>.</p>


<h3 class="fn"><a name="totalTimeChanged" />void totalTimeChanged (qint64)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted as soon as the total time of the media
file is known or has changed. For most non-local media data the
total time of the media can only be known after some time. At that
time the totalTime function can not return useful information. You
have to wait for this signal to know the real total time.</p>
<p><i>newTotalTime</i> is the length of the media file in
milliseconds.</p>
<p><b>See also</b> <a href="phonon-mediaobject.html#totalTime">totalTime</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>